package models;

import javax.persistence.Entity;
import javax.persistence.OneToOne;

import play.db.jpa.Model;


@Entity
public class Cordinate extends Model{
   
   private double  latitude;
   private double  longitude;
   private long placeInfoId;

public Cordinate(double latitude, double longitude){
	this.latitude = latitude;
	this.longitude = longitude;
}   
   
public double getLatitude() {
	return latitude;
}
public void setLatitude(double latitude) {
	this.latitude = latitude;
}
public double getLongitude() {
	return longitude;
}
public void setLongitude(double longitude) {
	this.longitude = longitude;
}
 public static Cordinate findOrCreate(double latitude,double longitude){
	 Cordinate newCordinate = Cordinate.find("latitude = ? and longitude = ?", latitude ,longitude).first();
	 if(newCordinate == null){
		 return new Cordinate(latitude, longitude);
	 }
	 return newCordinate;
 }

public PlaceInfo getBasePlace() {
	return null;
}

public void setBasePlace(PlaceInfo placeInfo) {
	this.placeInfoId = placeInfo.getId();
}

public long getPlaceInfoId() {
	return placeInfoId;
}

public void setPlaceInfoId(long placeInfoId) {
	this.placeInfoId = placeInfoId;
}

}
